﻿<Controls:MetroWindow x:Class="LOLVideo.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:helper="clr-namespace:LOLVideo.Helper"
        xmlns:Ex="clr-namespace:ExtendPropertyLib.XAML.Converters;assembly=ExtendPropertyLib.WPF"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
        Height="720" Width="1250" 
        ResizeMode="CanMinimize" 
        WindowStartupLocation="CenterScreen"
        ShowMaxRestoreButton="False" 
        ShowMinButton="True"
        TitlebarHeight="40"
        Icon="logo.png" >
    <Controls:MetroWindow.WindowCommands>
        <Controls:WindowCommands>
            <Button Content="设置" Click="btnSetting" />
            <Button Content="下载管理" Click="btnOnDownloadShow" />
        </Controls:WindowCommands>
    </Controls:MetroWindow.WindowCommands>

    <Controls:MetroWindow.TaskbarItemInfo>
        <TaskbarItemInfo ProgressState="Indeterminate"   ProgressValue="100" >
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo Description="英雄联盟视频" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Controls:MetroWindow.TaskbarItemInfo>
    
    <Grid>
        <Grid.Resources>
            <Ex:BoolToVisibilityConverter x:Key="btv"/>
      

        
        </Grid.Resources>
    <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="693*"/>
                <RowDefinition Height="55"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid Grid.Column="0" Margin="0,2,0,0.5" Grid.Row="0" Panel.ZIndex="9">
                <Border Margin="0.2,0,0,0"  BorderThickness="0.4,0,0,0"  >
                    <Border.BorderBrush>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF555454" Offset="0"/>
                            <GradientStop Color="#FF8D8D8D" Offset="1"/>
                            <GradientStop Color="#FF625E5E" Offset="0.501"/>
                        </LinearGradientBrush>
                    </Border.BorderBrush>
                    <Border.Background>
                        <LinearGradientBrush EndPoint="1.993,0.356" StartPoint="-0.353,0.359">
                            <GradientStop Color="#FF373737" Offset="0"/>
                            <GradientStop Color="#FE2F2F2F" Offset="0.409"/>
                            <GradientStop Color="#FE2D2B2B" Offset="0.526"/>
                            <GradientStop Color="#FE212121" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Border.Effect>
                        <DropShadowEffect BlurRadius="5" Direction="360" Color="#FF111111"   ShadowDepth="2" />
                    </Border.Effect>
                    <DockPanel>
                        <Border DockPanel.Dock="Top" BorderThickness="0.3" CornerRadius="1" Height="22">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF4B4B4B" Offset="0" />
                                    <GradientStop Color="Black" Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <TextBlock Text="视频源" HorizontalAlignment="Center" VerticalAlignment="Center"  FontSize="12" />
                        </Border>
                        <Grid Margin="0,5,0,0" >
                            <ListBox x:Name="albumList" ItemsSource="{Binding AlbumList}" SelectedIndex="0"  >
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="ListBoxItem">
                                        <Setter Property="HorizontalAlignment" Value="Center" />
                                  
                                        
                                        <Setter Property="Margin" Value="3" />
                                    </Style>
                                </ListBox.ItemContainerStyle>
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseUp">
                                        <i:InvokeCommandAction Command="{Binding OnAlbumSelectedCommand}" CommandParameter="{Binding SelectedItem,ElementName=albumList}"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" FontSize="14" FontFamily="Microsoft YaHei" >
                                            <TextBlock.Foreground>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#FFFFF747" Offset="0.215"/>
                                                    <GradientStop Color="#FFF5B961" Offset="0.588"/>
                                                    <GradientStop Color="#FFF9CB68" Offset="0.557"/>
                                                    <GradientStop Color="#FFFDCF32" Offset="0.885"/>
                                                </LinearGradientBrush>
                                            </TextBlock.Foreground>
                                          
                                        
                                        </TextBlock>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                              
                            </ListBox>
                         
                        </Grid>
                    </DockPanel>

                </Border>

            </Grid>
            <Border Grid.Column="1" Margin="0,2,0,0" BorderThickness="0.2,0,0,0" CornerRadius="1" BorderBrush="#FF525252" Grid.Row="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="23" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Border BorderThickness="0.3" Height="22"  Grid.Row="0">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF4B4B4B" Offset="0" />
                                <GradientStop Color="Black" Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                        <TextBlock Text="专辑列表" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="12" />
                    </Border>
                    <Grid Grid.Row="1"  >
                        <Grid.Background>
                            <LinearGradientBrush EndPoint="1.993,0.356" StartPoint="-0.353,0.359">
                                <GradientStop Color="#FF272626" Offset="0"/>
                                <GradientStop Color="#FE252424" Offset="0.26"/>
                                <GradientStop Color="#FE383737" Offset="0.61"/>
                                <GradientStop Color="#FE212121" Offset="1"/>
                            </LinearGradientBrush>
                        </Grid.Background>

                        <ListBox x:Name="ls" ItemsSource="{Binding CurrentAlbum.Videos,IsAsync=True}" Margin="14,5,5,5" 
                             ScrollViewer.ScrollChanged="ListBox_ScrollChanged"
                             ScrollViewer.CanContentScroll="False" 
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                             ScrollViewer.VerticalScrollBarVisibility="Visible"
                             Grid.Row="0"  >
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Margin" Value="7" />
                                    <Setter Property="Padding" Value="2"/>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseUp">
                                    <i:InvokeCommandAction Command="{Binding OnSelectedItemCommand}" CommandParameter="{Binding SelectedItem,ElementName=ls}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding Path=ImageLoadedComplate}" Value="True">
                                            <DataTrigger.EnterActions>
                                                <BeginStoryboard >
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="img">
                                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.1"/>
                                                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </DataTrigger.EnterActions>
                                        </DataTrigger>
                                    </DataTemplate.Triggers>

                                    <Grid Cursor="Hand">
                                        <StackPanel Height="125" Width="150">
                                            <Border BorderBrush="Black" BorderThickness="1" CornerRadius="3" Background="Black">
                                                <Border.Effect>
                                                    <DropShadowEffect BlurRadius="6" Color="#FF292929" Direction="280" ShadowDepth="3"/>
                                                </Border.Effect>
                                                <Image x:Name="img" Source="{Binding Image}" Height="88" Opacity="0" />
                                            </Border>

                                            <TextBlock Text="{Binding Name}" Foreground="WhiteSmoke"   TextWrapping="Wrap" Margin="0,4,0,0"  VerticalAlignment="Center" TextOptions.TextRenderingMode="ClearType" FontFamily="Microsoft YaHei"  FontSize="11">
                                              
                                            </TextBlock>
                                        </StackPanel>
                                        <Grid Margin="7,5,0,0">
                                            <TextBlock Text="{Binding TimeLong}"/>
                                        </Grid>
                                    </Grid>
                                </DataTemplate>

                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Grid  Panel.ZIndex="998"  Visibility="{Binding IsLoading,Converter={StaticResource btv}}"  Grid.Row="0" Opacity="0.93" Background="#FF1F1F1F" >
                            <StackPanel VerticalAlignment="Center" Height="170" >
                                <Controls:ProgressRing IsActive="True" Height="100" Width="100" Foreground="#FF910FFF" Margin="0,20,0,0"/>
                                <TextBlock Text=""/>
                                <TextBlock Margin="8" Text="数据正在加载......" HorizontalAlignment="Center"  FontWeight="Bold" FontSize="14" Foreground="#FFAB47FF" FontFamily="Microsoft YaHei"/>
                            </StackPanel>
                        </Grid>
                      
                    </Grid>
                  
                </Grid>
            </Border>
            <Border Grid.Row="1" Grid.ColumnSpan="2" Margin="0.5" BorderBrush="#FF6C6C6C" BorderThickness="0.3,0.5,0.3,0.3" >
            <Grid >
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF2B2A2A" Offset="0"/>
                        <GradientStop Color="#FF383838" Offset="1"/>
                        <GradientStop Color="#FF1F1F1F" Offset="0.482"/>
                    </LinearGradientBrush>
                </Grid.Background>
                  
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Width="1200"  >
                        <Border Width="255" Height="33"  Margin="15,10,0,10" >
                            <StackPanel Orientation="Horizontal">
                            
                               
                                <TextBlock  HorizontalAlignment="Left" VerticalAlignment="Center"  Margin="0,1,0,0" FontSize="15" >反TP补丁:</TextBlock>
                                <Controls:ToggleSwitch HorizontalAlignment="Left"   IsChecked="{Binding IsNoTP}"   Height="45" VerticalAlignment="Center" Margin="0,-6" Width="96" IsEnabled="True" ToolTip="此版本不提供反TP服务" >
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <i:InvokeCommandAction Command="{Binding OnApplyTPCommand}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </Controls:ToggleSwitch>
                                <TextBlock Text="无限视距:"  HorizontalAlignment="Left" VerticalAlignment="Center"  Margin="10,1,0,0" FontSize="15"/>
                                <CheckBox IsChecked="{Binding IsOpenView}"  VerticalAlignment="Center" Margin="3,1,0,0" IsEnabled="True" ToolTip="目前不建议使用" >
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <i:InvokeCommandAction Command="{Binding OnOpenViewsCheckedCommand}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </CheckBox>
                            </StackPanel>
                        </Border>
                   
                    
                        <Button Name="SkinModify"  Width="152"  Height="33"   Margin="26,0,0,0" BorderBrush="#FF727272"  Style="{DynamicResource ButtonStyle1}" >
                            <Button.Effect>
                                <DropShadowEffect ShadowDepth="2" BlurRadius="4" Direction="308" Opacity="0.965"/>
                            </Button.Effect>
                            <Button.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF403E2B" Offset="0"/>
                                    <GradientStop Color="#FF76764E" Offset="1"/>
                                    <GradientStop Color="#FF665C42" Offset="0.46"/>
                                </LinearGradientBrush>
                            </Button.Background>
                            <TextBlock Text="皮肤修改" FontWeight="Bold" Foreground="White" FontSize="14"  FontFamily="Microsoft YaHei" TextOptions.TextRenderingMode="ClearType"/>
                        </Button>


                        <Button x:Name="ShowHeros" Width="152" Height="33" Margin="26,0,0,0" Click="ShowHeros_Click" BorderBrush="#FF727272" FontWeight="Bold" Foreground="White" FontSize="14" FontFamily="Microsoft YaHei" TextOptions.TextRenderingMode="ClearType" Style="{DynamicResource ButtonStyle1}"  >
                            <Button.Effect>
                                <DropShadowEffect ShadowDepth="2" BlurRadius="4" Direction="308" Opacity="0.965"/>
                            </Button.Effect>
                            <Button.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF9BECA5" Offset="0"/>
                                    <GradientStop Color="#FF69DA48" Offset="1"/>
                                    <GradientStop Color="#FF468140" Offset="0.458"/>
                                </LinearGradientBrush>
                            </Button.Background>

                            英雄视频列表 ▲
                        </Button>


                        <Button Name="LookOb" Visibility="Visible"  Width="152"  Height="33"   Margin="26,0,0,0" BorderBrush="#FF727272"  Style="{DynamicResource ButtonStyle1}" >
                            <Button.Effect>
                                <DropShadowEffect ShadowDepth="2" BlurRadius="4" Direction="308" Opacity="0.965"/>
                            </Button.Effect>
                            <Button.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFF58868" Offset="0"/>
                                    <GradientStop Color="#FFB83E3E" Offset="1"/>
                                    <GradientStop Color="#FF914040" Offset="0.45"/>
                                </LinearGradientBrush>
                            </Button.Background>
                            <TextBlock Text="高端局观察者" FontWeight="Bold" Foreground="White" FontSize="14"  FontFamily="Microsoft YaHei" TextOptions.TextRenderingMode="ClearType"/>
                        </Button>


                     
                        <Button Name="RunReplay"  Content="打开录像" Width="152" Height="33" Margin="26,0,0,0"  BorderBrush="#FF727272" FontSize="14" FontWeight="Bold" Foreground="White" FontFamily="Microsoft YaHei" TextOptions.TextRenderingMode="ClearType"  Style="{DynamicResource ButtonStyle1}" >
                            <Button.Effect>
                                <DropShadowEffect ShadowDepth="2" BlurRadius="4" Direction="308" Opacity="0.965"/>
                            </Button.Effect>
                            <Button.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFD66AB" Offset="0"/>
                                    <GradientStop Color="#FFE03B77" Offset="1"/>
                                    <GradientStop Color="#FFA02A72" Offset="0.46"/>
                                </LinearGradientBrush>
                            </Button.Background>
                        </Button>
                        <Button Name="PlayGame" Width="152"  Height="33"   Margin="26,0,0,0" BorderBrush="#FF727272"  Style="{DynamicResource ButtonStyle1}" >
                            <Button.Effect>
                                <DropShadowEffect ShadowDepth="2" BlurRadius="4" Direction="308" Opacity="0.965"/>
                            </Button.Effect>
                            <Button.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF5EA8E2" Offset="0"/>
                                    <GradientStop Color="#FF5A8AF1" Offset="1"/>
                                    <GradientStop Color="#FF316DC5" Offset="0.462"/>
                                </LinearGradientBrush>
                            </Button.Background>
                            <TextBlock Text="启动游戏" FontWeight="Bold" Foreground="White" FontSize="14"  FontFamily="Microsoft YaHei" TextOptions.TextRenderingMode="ClearType"/>
                        </Button>
                    </StackPanel>
                    
            </Grid>
            </Border>
        </Grid>
        <helper:PopupNonTopmost x:Name="pop" PopupAnimation="Fade"   IsOpen="False" Placement="Top" PlacementTarget="{Binding ElementName=ShowHeros}"  Panel.ZIndex="999"   AllowsTransparency="True" StaysOpen="False" VerticalOffset="15" HorizontalOffset="-255">
            <Grid Height="565" Width="660" Opacity=".92"  >
                <Border Height="500" Width="650" CornerRadius="10"  BorderThickness="1,1,1,0">
                <Border.Effect>
                    <DropShadowEffect BlurRadius="7" Direction="365" Color="#FF232222" Opacity="1" ShadowDepth="5"/>
                </Border.Effect>
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF505050" Offset="0"/>
                        <GradientStop Color="Gray" Offset="0.991"/>
                        <GradientStop Color="#FF646464" Offset="0.466"/>
                    </LinearGradientBrush>
                </Border.BorderBrush>
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF3F3F46" Offset="0"/>
                        <GradientStop Color="#FF3B3B3B" Offset="1"/>
                        <GradientStop Color="#FF3F3F46" Offset="0.44"/>
                    </LinearGradientBrush>
                </Border.Background>
                    <Grid>
                        <Path Data="M3.8134058,394.37657 L199.44736,397.64959 253.50018,415.49976 301.50014,397.49989 493.49997,391.49994" Height="15" Margin="2.813,0,4.5,-9.5" Stretch="Fill" Stroke="#FF373737" VerticalAlignment="Bottom">
                    <Path.Effect>
                        <DropShadowEffect/>
                    </Path.Effect>
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                            <GradientStop Color="#FF3C3C3C" Offset="0"/>
                            <GradientStop Color="#FF2F2F2F" Offset="0.997"/>
                            <GradientStop Color="#FF353434" Offset="0.491"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
                     <ListBox x:Name="herolist" Margin="7"  ItemsSource="{Binding HeroList,IsAsync=True}" 
                             ScrollViewer.CanContentScroll="False" 
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                             ScrollViewer.VerticalScrollBarVisibility="Visible" >
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseUp">
                                    <i:InvokeCommandAction Command="{Binding OnHeroSelectedCommand}" CommandParameter="{Binding SelectedItem,ElementName=herolist}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">

                                    <Setter Property="Margin" Value="8" />
                                    <Setter Property="Padding" Value="3" />
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Height="90" Width="77">
                                        <StackPanel.ToolTip>
                                            <ToolTip Background="#FF1D1D1D" HasDropShadow="True" >
                                                <ToolTip.Effect>
                                                    <DropShadowEffect ShadowDepth="6" BlurRadius="6" Direction="355"/>
                                                </ToolTip.Effect>

                                                <Border  BorderThickness="1" CornerRadius="3">
                                                <StackPanel  >
                                                    <TextBlock Text="{Binding Name}" Foreground="#FF3F3F46" FontSize="14"/>
                                                    <TextBlock Text="{Binding EngishName}" Foreground="#FF3F3F46" FontSize="12" />
                                                </StackPanel>
                                            </Border>
                                            </ToolTip>


                                          
                                        </StackPanel.ToolTip>
                                        <Border BorderBrush="Black" BorderThickness="1" CornerRadius="3" Background="Black">
                                          
                                            <Image x:Name="img" Source="{Binding Image}" Height="65px" Width="65px"/>
                                        </Border>

                                        <TextBlock Text="{Binding Title}" Foreground="WhiteSmoke" HorizontalAlignment="Center"   TextWrapping="Wrap" Margin="0,4,0,0" FontSize="13"  FontFamily="Microsoft YaHei"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </Border>
            </Grid>
        </helper:PopupNonTopmost>
    </Grid>
</Controls:MetroWindow>
